#!/bin/sh

. /usr/share/common

start() {
	usbmac=$(fw_printenv -n usbmac)
	if [ -z "$usbmac" ]; then
		decrement_mac
		daddr=$ethaddr
	else
		daddr=$usbmac
	fi

	starting
	modprobe g_ncm iManufacturer=thingino host_addr=$(fw_printenv -n ethaddr) dev_addr=$daddr iProduct="NCM CDC Ethernet Gadget"
	usb-role -m device
}

case "$1" in
	start)
		start
		;;
	stop)
		true
		;;
	*)
		echo "Usage: $0 {start}"
		exit 1
		;;
esac

exit 0
